//
//  RepayScheduleViewController.swift
//  cxd4iphone
//
//  Created by hexy on 12/3/15.
//  Copyright © 2015 hexy. All rights reserved.
//

import UIKit

class RepayPlanViewController: BaseTableViewController {

    private lazy var repayPlanListViewModel = RepayPlanListViewModel()
    
    var loanId = String()
    
    init(loanId: String) {
        
        super.init(style: .Plain)
        
        self.title = "还款计划"
        self.loanId = loanId
        
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
        
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        xx_showHUD(nil)
        repayPlanListViewModel.loadRepayPlanList(loanId).subscribeError({ (error) -> Void in
            
                xx_showError(error)
            }) { () -> Void in
                
                xx_hideHUD()
                self.tableView.reloadData()
        }
        
       
        
    }

    override func makeTableView() {
        
        
        tableView.rowHeight = xx_height(135)
        
        self.tableListViewModel = repayPlanListViewModel
        tableView.registerClass(RepayPlanListCell.self, forCellReuseIdentifier: RepayPlanCellReuseID)
        tableView.sectionFooterHeight = 0.1
        
        
    }
}
